{% set namespace = "AWS/CloudFront" %}
{% set dff_api_title = "AWS-CloudFront Collection" %}
{% set dff_api_crontab = "* * * * *" %}

{% extends "base_template" %}
{% block import %}
{{ super() }}
import integration_aws_cloudfront__main as obj_main
import integration_aws_cloudwatch__main as monitor_main
{% endblock %}

{% block account %}
{{ super() }}
{% endblock %}

{% block collect_configs %}
collector_configs = {
    {% if account_config.area == "intl"%}
    'regions': 'ap-northeast-1'
    {% else %}
    'regions': 'cn-north-1'
    {% endif%}
}

monitor_configs = {
    'regions': ['us-east-1'],
    'targets': [
        {
            'namespace': {{ repr(namespace) }},
            {% if collector.dimensions %}
            {% set dimensions = collector.dimensions.split(',') %}
            'dimensions': {{ repr(dimensions) }},
            {% endif %}
            {% if collector.metrics %}
            'metrics'  : {{ repr(collector.metrics) }}
            {% else %}
            'metrics'  : []
            {% endif %}
        }
    ]
}
{% endblock %}

{% block filters%}
{% endblock %}

{% block run %}
{{ super() }}
{% endblock %}
